Python: Learn Python (Advanced) in 7 Days and Ace It Well. Hands On Challenges INCLUDED! (Python Programming Book Series 2) by Ronald Olsen
Author:Ronald Olsen [Olsen, Ronald]
Language: eng
Format: azw3
Tags: Data Analysis, Python, Python programming, Computer programming, Learn coding, Machine Learning
Publisher: AUVA PRESS
Published: 2017-06-26T04:00:00+00:00
Solution for Challenge 8
def memoize(func):
func.cache = {}
def wrapper(n):
try:
ans = func.cache[n]
except KeyError:
ans = func.cache[n] = func(n)
return ans
return wrapper
@conceptualize
def myfibonacci(n):
"""
>>> print(myfibonacci.cache)
{}
>>> myfibonacci(1)
1
>>> myfibonacci(2)
1
>>> myfibonacci(10)
55
>>> myfibonacci.cache[10]
55
>>> myfibonacci(40)
102334155
"""
assert n >= 0
if n < 2:
return n
else:
return myfibonacci(n-1) + myfibonacci(n-2)
Chapter 8
Python Descriptors
This chapter explores Python descriptors, their syntax, how they are called and several built-in Python descriptors, including the functions, the properties, and the static methods. Let’s jump right in.
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Deep Learning with Python by François Chollet(12579)
Hello! Python by Anthony Briggs(9918)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9797)
The Mikado Method by Ola Ellnestam Daniel Brolund(9780)
Dependency Injection in .NET by Mark Seemann(9341)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8303)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7764)
Grails in Action by Glen Smith Peter Ledbrook(7699)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7558)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7104)
Microservices with Go by Alexander Shuiskov(6873)
Practical Design Patterns for Java Developers by Miroslav Wengner(6785)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6731)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6420)
Angular Projects - Third Edition by Aristeidis Bampakos(6143)
The Art of Crafting User Stories by The Art of Crafting User Stories(5667)
NetSuite for Consultants - Second Edition by Peter Ries(5599)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5409)
Kotlin in Action by Dmitry Jemerov(5068)
